Skip to content

feat(@angular/build): migrate Angular Linker to oxc-parser and magic-string#33625

Open
clydin wants to merge 1 commit into
angular:mainfrom
clydin:feat/linker-oxc-migration
Open

feat(@angular/build): migrate Angular Linker to oxc-parser and magic-string#33625
clydin wants to merge 1 commit into
angular:mainfrom
clydin:feat/linker-oxc-migration

Conversation

@clydin

@clydin clydin commented Jul 22, 2026

Copy link
Copy Markdown
Member

This refactors the Angular linker processing in the ESBuild pipeline to use oxc-parser and magic-string instead of @babel/core.

By using the lightweight AST and precise token spans provided by OXC, the linker is able to process partial declarations via targeted magic-string overwrites in-place. This removes the dependency on @babel/core and the linker Babel plugin, yielding faster build startup times and improved compilation performance.

@angular-robot angular-robot Bot added detected: feature PR contains a feature commit area: @angular/build labels Jul 22, 2026
…string

This refactors the Angular linker processing in the ESBuild pipeline to use `oxc-parser` and `magic-string` instead of `@babel/core`.

By using the lightweight AST and precise token spans provided by OXC, the linker is able to process partial declarations via targeted `magic-string` overwrites in-place. This removes the dependency on `@babel/core` and the linker Babel plugin, yielding faster build startup times and improved compilation performance.
@clydin
clydin force-pushed the feat/linker-oxc-migration branch from 89f575b to a1a721b Compare July 22, 2026 16:40
@clydin
clydin marked this pull request as ready for review July 23, 2026 19:03

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a high-performance Angular partial declaration linker using oxc-parser and magic-string to replace the Babel-based linker. The review feedback highlights critical compatibility issues with the OXC AST structure. Specifically, oxc-parser does not export a Visitor class, requiring a custom recursive AST walker instead. Additionally, OXC AST node types differ from standard ESTree nodes: generic Literal nodes are represented as specific StringLiteral, NumericLiteral, BooleanLiteral, and NullLiteral nodes; identifiers are split into IdentifierReference and IdentifierName; and object properties are represented as ObjectProperty instead of Property.

Comment thread packages/angular/build/src/tools/angular/linker/oxc-linker.ts
Comment thread packages/angular/build/src/tools/angular/linker/oxc-linker.ts
Comment thread packages/angular/build/src/tools/angular/linker/oxc-ast-host.ts
Comment thread packages/angular/build/src/tools/angular/linker/oxc-ast-host.ts
Comment thread packages/angular/build/src/tools/angular/linker/oxc-ast-host.ts
Comment thread packages/angular/build/src/tools/angular/linker/oxc-ast-host.ts
Comment thread packages/angular/build/src/tools/angular/linker/oxc-ast-host.ts
Comment thread packages/angular/build/src/tools/angular/linker/oxc-ast-host.ts
Comment thread packages/angular/build/src/tools/angular/linker/oxc-ast-host.ts
Comment thread packages/angular/build/src/tools/angular/linker/oxc-ast-host.ts
@clydin clydin added the target: minor This PR is targeted for the next minor release label Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: @angular/build detected: feature PR contains a feature commit target: minor This PR is targeted for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant